package com.yc.demo.d0304;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "onlineServlet", value = "/onlineServlet")
public class onlineServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        request.setCharacterEncoding("utf-8");
//        response.setContentType("text/html;charset=utf-8");
//        //获取当前在线人数
//        int size = OnlineListener.onlineUsers.size();
//        PrintWriter out = response.getWriter();
//
//        out.printf("<dl><dt>在线人数：%d</>",size);
//        for (String onlineUser : OnlineListener.onlineUsers) {
//            out.printf("<dd>%s</dd>",onlineUser);
//        }
//        out.println("</dl>");


    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
